import javax.faces.bean.ManagedBean;
import javax.faces.bean.NoneScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;


@ManagedBean
@ViewScoped
public class LayoutBean {
	private String includedPage;
	private String theme="sunny";
	private String styleClass;
	
	public String getTheme() {
		return theme;
	}

	public LayoutBean(){
		includedPage="Default.xhtml";// LoadedFiles.xhtml
	}

	public String getIncludedPage() {
		return includedPage;
	}

	public void setIncludedPage(String includedPage) {
		this.includedPage = includedPage;
	}

	public String getStyleClass() {
		return styleClass;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}
	
	public String getCssForEditMenuItem(String editMenuItem) {
	        String styleClass = new String();
	        if (editMenuItem.equals(includedPage))
	            styleClass = "orders-menuitem-selected";
	        else
	            styleClass = "orders-menuitem-text";
	        return styleClass;
	}


	public void showPage() {
		   String selectedPage = (String) UIComponent.getCurrentComponent(FacesContext.getCurrentInstance()).getAttributes().get("pageViewId");
		   
		   if (selectedPage.equals("LoadedFiles")) {
			includedPage = "LoadedFiles.xhtml";
			}
		   
		   if (selectedPage.equals("CountryMapping")) {
			includedPage = "CountryMapping.xhtml";
			}
		   
		   if (selectedPage.equals("ControlDistInfo")) {
			includedPage = "ControlDistInfo.xhtml";
			}
		   
		   if (selectedPage.equals("StockUpdateStatus")) {
			includedPage = "StockUpdateStatus.xhtml";
			}
		   
		   if (selectedPage.equals("unMappedItems")) {
			includedPage = "unMappedItems.xhtml";
			}
		   
		   if (selectedPage.equals("MatchingReport")) {
				includedPage = "MatchingReport.xhtml";
			}
		   
		   if (selectedPage.equals("StocksMatching")) {
				includedPage = "StocksMatching.xhtml";
			}
		   
		   if (selectedPage.equals("OutletMasterInfo")) {
				includedPage = "OutletMasterInfo.xhtml";
			}
		   
		   if (selectedPage.equals("SalesSummary")) {
				includedPage = "SalesSummary.xhtml";
			}
		   
		   if (selectedPage.equals("InvoiceDetails")) {
				includedPage = "InvoiceDetails.xhtml";
			}
		   
		   if (selectedPage.equals("ReturnDetails")) {
				includedPage = "ReturnDetails.xhtml";
			}
		   
		   if (selectedPage.equals("StockDetails")) {
				includedPage = "StockDetails.xhtml";
			}
		   
		   if (selectedPage.equals("ChubInvoices")) {
				includedPage = "ChubInvoices.xhtml";
			}
		   
		   if (selectedPage.equals("ChubStocks")) {
				includedPage = "ChubStocks.xhtml";
			}
		   
	}
}
